<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns="http://www.w3.org/1999/xhtml"
                xmlns:p="http://primefaces.org/ui">


    <ui:define name="content">
        <h:form>


            <p:panel id="reportPrint" >

                <f:facet name="header" >
                    <h:outputLabel value="Staff Payment Report"/>
                    <p:commandButton ajax="false" value="Refresh" styleClass="noPrintButton" actionListener="#{commonReport.recreteModal()}" style="float: right;"/>  
                    <p:commandButton ajax="false" value="Print" styleClass="noPrintButton" style="float: right;">
                        <p:printer target="reportPrint" />
                    </p:commandButton>  
                </f:facet>

                <p:panelGrid columns="5" styleClass="summerySelection"  >

                    <h:outputLabel value="From Date"/>
                    <p:calendar id="frmDate" value="#{commonReport.fromDate}" navigator="true"  pattern="dd MMMM yyyy HH:mm:ss" >
                    </p:calendar>

                    <h:outputLabel value="To Date"/>
                    <p:calendar id="toDate" value="#{commonReport.toDate}" navigator="true" pattern="dd MMMM yyyy HH:mm:ss" styleClass="reportCruteria" >
                    </p:calendar>
                </p:panelGrid>

                <p:panel id="data">
                    <p:dataTable id="report4" value="#{commonReport.institutionPaymentBillsOwn}" var="b" rendered="#{commonReport.institutionPaymentBills.size()!=0}"  sortBy="#{b.billType}"  style="font-size: 10px; ">
                        <f:facet name="header">  
                            Payments Bills 
                        </f:facet> 
                        <p:column headerText="Date" rendered="#{commonReport.fromDate ne commonReport.toDate}"  >
                            <h:commandLink action="payment_bill_reprint" >
                                <h:outputLabel value="#{b.createdAt}">
                                    <f:convertDateTime pattern="dd MMMM yyyy hh:mm:ss a"/>
                                </h:outputLabel>
                                <f:setPropertyActionListener value="#{b}" target="#{staffPaymentBillController.current}"/>
                                <f:setPropertyActionListener value="#{b.staff}" target="#{staffPaymentBillController.currentStaff}"/>
                            </h:commandLink>
                        </p:column>
                        <p:column headerText="Bill Id">
                            #{b.insId}
                        </p:column>
                        <p:column headerText="Staff Name">
                            #{b.staff.person.nameWithTitle}
                        </p:column>
                        <p:column headerText="Cash Payment" style="text-align: right;" rendered="#{commonReport.paymentCashTot!=0.0}"  >
                            <h:outputLabel rendered="#{b.paymentMethod=='Cash'}" value="#{b.netTotal}" >
                                <f:convertNumber pattern="#,##0.00"/>
                            </h:outputLabel>
                            <h:outputLabel rendered="#{b.paymentMethod!='Cash'}" value="0.00"/>
                        </p:column>
                        <p:summaryRow>
                            <p:column colspan="3">
                                Cash Total:
                            </p:column>
                            <p:column style="text-align: right;">
                                <h:outputLabel value="#{commonReport.paymentCashTot}"><f:convertNumber pattern="#,##0.00" /></h:outputLabel>
                            </p:column>
                        </p:summaryRow>
                        
                    </p:dataTable>

                </p:panel>

            </p:panel>



        </h:form>
    </ui:define>

</ui:composition>
